import {ComponentType} from 'react'
import Taro, {Component, Config} from '@tarojs/taro'
import {View, Button, Text, Swiper, SwiperItem, Image} from '@tarojs/components'



import './cashSuccess.less'

import icon_08 from '../../assets/img/icon_08.png'
import {getRuntime, servicePhoneNumber} from "../../utils/common";

class CashSuccess extends Component {
  componentWillMount() {
    Taro.setNavigationBarTitle({title: '申请成功'})
  }

  makePhone() {
    getRuntime().makePhoneCall(servicePhoneNumber)
  }

  link(url: string = '/pages/index/index'): void {
    getRuntime().navigateTo(url)
  }

  render() {
    let cashInfo = getRuntime().getStorage('cashInfo') || {}
    return (
      <View className='pay-success cash-success'>
         <View className='pay__header'>
            <Image src={icon_08} className='pay-icon' />
            <View className='pay__title'>提现申请成功</View>
            <View className='pay__desc color-dark'>我们会尽快为您提现, 请耐心等待</View>
            <View className='pay__desc color-theme'>预计4小时内到账</View>
         </View>
          <View className='interval' />

          <View className='line-wrap'>
            <View className='line'>
              <View className='line__title'>提现金额</View>
              <View className='line__cont'>
                <Text className='small color-theme'>￥</Text>
                <Text className='color-theme font-weight'>{cashInfo.cashAmount}</Text>
              </View>
            </View>
            <View className='line'>
              <View className='line__title'>手续费</View>
              <View className='line__cont'>
                <Text className='small'>￥</Text>
                <Text className='font-weight'>{cashInfo.cashServiceMoney}</Text>
              </View>
            </View>
            {/*<View className='line'>
              <View className='line__title'>实扣金额</View>
              <View className='line__cont'>
                <Text className='small'>￥</Text>
                <Text className='font-weight'> 666.66</Text>
              </View>
            </View>*/}
          </View>

        <View className='interval' />

        <View className='line-wrap'>
          <View className='line'>
            <View className='line__title'>提现方式</View>
            <View className='line__cont'>
              <Text className='small'>{cashInfo.cashType}</Text>
            </View>
          </View>
        </View>

        <View className='circular-submit' onClick={this.link.bind(this,'/pages/mine/index')}>确定</View>
        <View className='service' onClick={this.makePhone.bind(this)}>客服热线: {servicePhoneNumber}</View>

      </View>
    )
  }
}

export default CashSuccess
